package com.mp.core.utils.common;

import com.mp.core.utils.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author Ace
 */
@Component
public final class RedisCommon {

    @Autowired
    private RedisUtil redisUtil;

    /**
     * redis后缀
     */
    private String redisSuffix = "_fly";


    /**
     * 设置飞单游戏状态
     * @param account
     * @param code
     * @param status
     */
    public boolean setGameStatus(String account, String code, Integer status) {
        return redisUtil.set("flyGameStatus_" + account + "_" + code + redisSuffix, status.toString());
    }

    /**
     * 获取飞单游戏状态
     * @param account
     * @param code
     * @return
     */
    public Integer getGameStatus(String account, String code) {
        return (Integer) redisUtil.get("flyGameStatus_" + account +"_" + code + redisSuffix);
    }


}
